<?php /* Smarty version Smarty-3.1.18, created on 2017-05-17 08:17:50
         compiled from "/data/www/mystery/protected/modules/webadmin/views/question/list.tpl" */ ?>
<?php /*%%SmartyHeaderCode:56544608454bfaf325049c7-09425010%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '3f52637ac01c93aee7ca30032d55dcd6ac6b1f87' => 
    array (
      0 => '/data/www/mystery/protected/modules/webadmin/views/question/list.tpl',
      1 => 1494904924,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '56544608454bfaf325049c7-09425010',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.18',
  'unifunc' => 'content_54bfaf325c3c53_45098615',
  'variables' => 
  array (
    'status' => 0,
    'key' => 0,
    'params' => 0,
    'val' => 0,
    'project_id' => 0,
    'list' => 0,
    'page' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_54bfaf325c3c53_45098615')) {function content_54bfaf325c3c53_45098615($_smarty_tpl) {?><?php if (!is_callable('smarty_modifier_date_format')) include '/data/www/mystery/protected/extensions/Smarty/plugins/modifier.date_format.php';
?><?php echo $_smarty_tpl->getSubTemplate ("../common/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

<table width="100%" border="0" cellspacing="0">
	<tr>
		<td width="13%" valign="top">
            <?php echo $_smarty_tpl->getSubTemplate ("../common/left.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>

		</td>
		
    <td width="87%" valign="top">
            <table width="100%" border="0" cellspacing="0">
            <tr>
                <td>
                <div class="subnav">
                    <form method="get" name="question_form" action="/webadmin/question/list">
                    <div class="explain-col">
                        <em>问卷状态：</em>
                            <select name="status" onchange="document.getElementById('form2').submit();">
                                <option value="">=请选择=</option>
                                <?php  $_smarty_tpl->tpl_vars['val'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['val']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['status']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['val']->key => $_smarty_tpl->tpl_vars['val']->value) {
$_smarty_tpl->tpl_vars['val']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['val']->key;
?>
                                <?php if ($_smarty_tpl->tpl_vars['key']->value!=0) {?>
                                <option <?php if ($_smarty_tpl->tpl_vars['params']->value['status']==$_smarty_tpl->tpl_vars['key']->value) {?>selected="selected"<?php }?> value="<?php echo $_smarty_tpl->tpl_vars['key']->value;?>
"><?php echo $_smarty_tpl->tpl_vars['val']->value;?>
</option>
                                <?php }?>
                                <?php } ?>
                            </select>
                        问卷名称：<input type="text" value="<?php echo $_smarty_tpl->tpl_vars['params']->value['question_name'];?>
" class="input-text" name="question_name">
                        问卷编号：
                        <input type="text" value="<?php echo $_smarty_tpl->tpl_vars['params']->value['identifier'];?>
" class="input-text" name="identifier">
                        <input type="submit" value="搜索" class="button" name="dosubmit">
                        <input type="hidden" value="<?php echo $_smarty_tpl->tpl_vars['project_id']->value;?>
" name="project_id"/>
                    </div>
                    </form>
                    <div class="content-menu ib-a blue line-x">
                            <a href="javascript:void(0);" class="on"><em>问卷管理</em></a><span>|</span>
                            <a href="/webadmin/question/add?project_id=<?php echo $_smarty_tpl->tpl_vars['project_id']->value;?>
"><em>添加问卷</em></a><span>|</span>
                            &nbsp;&nbsp;&nbsp;&nbsp;
                            <a href="/webadmin/question/templateDown" title="问卷内容模板样例" style="color:#00549b;font-weight: bold;">问卷内容模板样例下载</a>
                    </div>
                </div>

                <div class="pad_10">
                <div class="table-list">
                    <table width="100%">
                    <thead>
                        <tr>
                                <th width="5%">问卷编号</th>
                                <th width="15%">问卷名称</th>
                                <th width="15%">所属项目</th>
                                <th width="15%">创建时间</th>
                                <th width="5%">状态</th>
                                <th width="45%">管理操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php  $_smarty_tpl->tpl_vars['val'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['val']->_loop = false;
 $_smarty_tpl->tpl_vars['key'] = new Smarty_Variable;
 $_from = $_smarty_tpl->tpl_vars['list']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['val']->key => $_smarty_tpl->tpl_vars['val']->value) {
$_smarty_tpl->tpl_vars['val']->_loop = true;
 $_smarty_tpl->tpl_vars['key']->value = $_smarty_tpl->tpl_vars['val']->key;
?>
                        <tr onMouseOver="this.className = 'tr2'" onMouseOut="this.className = 'tr1'" class="tr1" id="question_<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
">
                                <td align="center"><?php echo $_smarty_tpl->tpl_vars['val']->value['identifier'];?>
</td>
                                <td align="center"><a href="javascript:void(0);"><span style=""><?php echo $_smarty_tpl->tpl_vars['val']->value['question_name'];?>
</span></a> </td>
                                <td align="center"><?php echo $_smarty_tpl->tpl_vars['val']->value['project_name'];?>
</td>
                                <td align="center"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['val']->value['create_time'],"%Y-%m-%d %H:%M:%S");?>
</td>
                                <td align="center">
                                        <?php if ($_smarty_tpl->tpl_vars['val']->value['status']==1) {?>
                                        <a href="javascript:void(0);" style="color:#00549b" onclick="upquestionstatus(<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
,2);"  title="点击发布问卷"><?php echo $_smarty_tpl->tpl_vars['status']->value[$_smarty_tpl->tpl_vars['val']->value['status']];?>
</a>
                                        <?php } elseif ($_smarty_tpl->tpl_vars['val']->value['status']==2) {?>
                                        <a href="javascript:void(0);" style="color:green" onclick="upquestionstatus(<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
,1);" title="点击设为草稿"><?php echo $_smarty_tpl->tpl_vars['status']->value[$_smarty_tpl->tpl_vars['val']->value['status']];?>
</a>
                                        <?php } else { ?>
                                        <?php echo $_smarty_tpl->tpl_vars['status']->value[$_smarty_tpl->tpl_vars['val']->value['status']];?>

                                        <?php }?>
                                </td>
                                
                                <td align="left">
                                   
                                        <a href="/webadmin/question/import?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
&type=1" title="导入问卷模板">导入问卷模板</a>&nbsp;&nbsp;
                                        <a href="/webadmin/question/view?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" target="_blank" title="预览问卷模板">预览问卷模板</a>&nbsp;&nbsp;
                                        <a href="/webadmin/question/answerImport?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" title="导入对标数据">导入对标数据</a>&nbsp;&nbsp;
                                        <a name="down" href="/webadmin/question/templateAnswerDown?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" target="_blank" title="对标数据模板下载" style="color:#00549b;font-weight: bold;">对标数据模板下载</a>&nbsp;&nbsp;
                                        <a name="benchmark_down" href="/webadmin/question/templateBenchmarkDown?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" target="_blank" title="导出申诉" style="color:#DB3F40;font-weight: bold;">导出申诉</a>&nbsp;&nbsp;
                                        <a name="benchmark_attach_down" href="javascript:;" onclick="export_attach(<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
);" title="导出申诉附件" style="color:#DB3F40;font-weight: bold;">导出申诉附件</a>&nbsp;&nbsp;
                                        <br/><a href="/webadmin/question/benchmarkImport?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" title="导入对标回答">导入对标回答</a>&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="up_attachment(<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
);" title="上传网点问卷附件">上传附件</a>&nbsp;&nbsp;
                                        
                                        <a href="/webadmin/netQuestion/list?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
&project_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['project_id'];?>
" title="预览上传问卷">预览上传问卷</a>&nbsp;&nbsp;
                                        <a href="/webadmin/question/set?qid=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" title="设置问卷内容">设置问卷内容</a>&nbsp;&nbsp;
                                        <a href="/webadmin/question/edit?question_id=<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" title="修改基础信息">修改基础信息</a>&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="show_score(<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
,'<?php echo $_smarty_tpl->tpl_vars['val']->value['identifier'];?>
',<?php echo $_smarty_tpl->tpl_vars['val']->value['show_score'];?>
);" title="是否显示得分">得分</a>&nbsp;&nbsp;
                                        <a name="delete" href="javascript:void(0);" rel="<?php echo $_smarty_tpl->tpl_vars['val']->value['question_id'];?>
" title="删除问卷">删除</a>&nbsp;&nbsp;
                                </td>
                              
                                        
                        </tr>
                        <?php } ?>
                    </tbody>
                    </table>

                    <div style="float:right;"><?php echo $_smarty_tpl->tpl_vars['page']->value;?>
</div>
            </div>
        </div>

        </td>
        </tr>
        </table>

		</td>

	</tr>
</table>
<script type="text/javascript">
//是否显示得分
function show_score(question_id,title,show_score){
    $.layer({
        shade: [0],
        offset: ['150px', ''],
        title : '提示',
        area: ['auto','auto'],
        dialog: {
            msg: title+'：是否显示得分？<br/>当前：'+(show_score==1 ? '显示' : '不显示'),
            btns: 2,                    
            type: 4,
            btn: ['是','否'],
            yes: function(){
                $.getJSON('/webadmin/question/score',{question_id:question_id,show_score:1},function(res){
                    layer.msg(res.msg);
                });
            }, no: function(){
                $.getJSON('/webadmin/question/score',{question_id:question_id,show_score:0},function(res){
                    layer.msg(res.msg);
                });
            }
        }
    });
}
	$(document).ready(function ($) {
		$('a[name="delete"]').click(function () {
			var id = $(this).attr('rel');
			if (id == '') {
				return false;
			}
			$or = confirm('你确定要删除吗？');
			if ($or) {
				$.ajax({
					type: 'post',
					async: true,
					dataType: "json",
					data: {'question_id':id},
					url: '/webadmin/question/delete',
					success: function (data) {
						if (data.status==1) {
                                                    $('#question_'+id).remove();
						}
                                                alert(data.note);
					}
				});
			}
		});
		
                // 模板下载提示
                $('a[name="down"]').click(function(){
                    var or = confirm("如果问卷网点比较多，在生成指标模板时所耗时间也会比较长，请耐心等待模板生成完成；\n\n 如果不想在线生成模板，也可按照提供的固定模板来填写指标回答内容");
                    if(or){
                        return true;
                    }else{
                        return false;
                    }
                });
                
                // 模板下载提示
                $('a[name="benchmark_down"]').click(function(){
                    var or = confirm("如果问卷网点比较多，在生成指标模板时所耗时间也会比较长，请耐心等待模板生成完成");
                    if(or){
                        return true;
                    }else{
                        return false;
                    }
                });
	
	});
//修改问卷状态
function upquestionstatus(question_id, status){
   var alt = status==2 ? '你确定要发布问卷？' : '你确定要改为草稿?';
    if (confirm(alt)) {
            $.ajax({
                    type: 'post',
                    async: true,
                    dataType: "json",
                    data: {'question_id':question_id,'status':status},
                    url: '/webadmin/question/release',
                    success: function (data) {
                            alert(data.note);
                            if (data.status==1) {
                                location.reload();
                            }
                    }
            });
    }
}
 //上传问卷对标附件
 function up_attachment(question_id){
  $.layer({
      type: 2,
      title: '问卷网点附件ZIP包上传',
      closeBtn: [0, true],
      shade: [0.5, '#000'],
      border:[10, 0.3, '#000'],
      offset: ['150px',''],
      area: ['550px', '400px'],
      iframe: {src: '/webadmin/question/attachment?question_id='+question_id}
  });  
}
//
function export_attach(question_id){
        $.getJSON('/webadmin/attach/benchmarkAttachDown',{question_id:question_id},function(res){
            
            if (res.status == 0) {
                alert(res.note);
                return false;
            }
            $.layer({
                offset: ['150px', 'auto'],
                shade: [0],
                area: ['auto','auto'],
                dialog: {
                    msg: '执行完毕，是否下载？',
                    btns: 2,                    
                    type: 4,
                    btn: ['确定','取消'],
                    yes: function(){
                        window.open(res.note);
                        layer.closeAll();
                    }, no: function(){
                       layer.closeAll() ;
                    }
                }
            });
        });
}
</script>
<?php echo $_smarty_tpl->getSubTemplate ("../common/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);?>
<?php }} ?>
